using System;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;

namespace HengTong.Model.Db.SupplyChain.Material;

/// <summary>
/// 物料分类
/// 用于管理和维护物料的分类信息，支持树形结构层级管理
/// </summary>
public class SysMaterialGroup : TreePoco<SysMaterialGroup>
{
    /// <summary>
    /// 物料分类简称
    /// </summary>
    [Display(Name = "简称", Description = "物料分类的简短名称")]
    [StringLength(24, ErrorMessage = "{0}长度不能超过{1}")]
    public string Name { get; set; }
    
    /// <summary>
    /// 物料分类编码
    /// 用于系统内部识别的唯一编码
    /// </summary>
    [Display(Name = "编码", Description = "用于系统内部识别的唯一编码")]
    [StringLength(64, ErrorMessage = "{0}长度不能超过{1}")]
    public string Code { get; set; }
    
    /// <summary>
    /// ERP系统ID
    /// 与外部ERP系统同步时使用的标识符
    /// </summary>
    [Display(Name = "ErpId", Description = "与外部ERP系统同步时使用的标识符")]
    [StringLength(50, ErrorMessage = "{0}长度不能超过{1}")]
    public string ErpId { get; set; }

    /// <summary>
    /// 物料分类详细描述
    /// 用于存储该物料分类的详细说明信息
    /// </summary>
    [Display(Name = "详情", Description = "用于存储该物料分类的详细说明信息")]
    [StringLength(1024, ErrorMessage = "{0}长度不能超过{1}")]
    public string Description { get; set; }

    /// <summary>
    /// 物料分类状态
    /// 表示该物料分类的当前状态（如启用、禁用等）
    /// </summary>
    [Display(Name = "状态", Description = "物料分类的当前状态（如启用、禁用等）")]
    public CommonState State { get; set; }
    
    /// <summary>
    /// 创建时间
    /// 记录该物料分类的创建时间
    /// </summary>
    [Display(Name = "创建时间", Description = "记录该物料分类的创建时间")]
    public DateTime? CreateTime { get; set; }
    
    /// <summary>
    /// 最后更新时间
    /// 记录该物料分类的最后一次修改时间
    /// </summary>
    [Display(Name = "最后更新时间", Description = "记录该物料分类的最后一次修改时间")]
    public DateTime? UpdateTime { get; set; }
    
    /// <summary>
    /// 创建人
    /// </summary>
    [StringLength(64)]
    [Display(Name = "创建人")]
    public string CreateBy { get; set; }
    
    /// <summary>
    /// 更新人
    /// </summary>
    [StringLength(64)]
    [Display(Name = "更新人")]
    public string UpdateBy { get; set; }
    
    /// <summary>
    /// 层级
    /// </summary>
    [Display(Name = "层级")]
    public int Level { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>
    [Display(Name = "备注", Description = "计量单位组的备注信息")]
    [StringLength(256)]
    public string Remark { get; set; }
    
    /// <summary>
    /// 流水号
    /// </summary>
    [Display(Name = "流水号", Description = "物料分类的流水号")]
    public uint SerialNumber { get; set; }
}

public class SysMaterialGroupView : SysMaterialGroup
{
    [Display(Name = "父级", Description = "上级物料分类")]
    public string ParentName { get; set; }
}